// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Mint from 'mint-ui'
import App from './App'
import router from './router'
import vueResource from 'vue-resource'
import VueScroller from 'vue-scroller'
import store from './store'
import axios from 'axios'
import Loading from 'components/loading/index.js'
import VueLazyload from 'vue-lazyload'

import 'common/stylus/icon.css'
import 'common/stylus/reset.css'
import Calendar from 'vue2-datepick'
import 'common/js/const.js'
import AMap from 'vue-amap';

Vue.config.productionTip = false

Vue.use(Mint);
Vue.use(vueResource);
Vue.use(VueScroller);

//Vue.use(Calendar);

Vue.use(Loading);
Vue.use(VueLazyload, {
  loading: require('./assets/default.png')
})
axios.interceptors.request.use(function (config) {  //配置发送请求的信息
  store.dispatch('showLoading')  
  return config;
}, function (error) {
  return Promise.reject(error);
});

axios.interceptors.response.use(function (response) { //配置请求回来的信息
  store.dispatch('hideLoading')
  return response;
}, function (error) {

  return Promise.reject(error);
});



Vue.use(AMap);
// 初始化vue-amap
AMap.initAMapApiLoader({
  // 申请的高德key
  key: 'e04eb12196a052a4a46a2c8d76152238',
  // 插件集合
  plugin: ['AMap.Autocomplete', 'AMap.Geocoder', 'AMap.PlaceSearch', 'AMap.Geolocation', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor']
});
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
